package models;

import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;

import models.exceptions.PublicException;

public class FutureRoom
{

    protected static List<String> playerTypes = Arrays.asList(new String[] {
            "0", "1"                         });

    public String                 ownerName;
    public List<String>           opponents;
    public int                    initCash;
    public int                    initFee;

    public FutureRoom(String ownerName, String type2, String type3,
            String type4, int initCash, int initFee) throws PublicException
    {
        this.ownerName = ownerName;
        this.opponents = new LinkedList<String>();
        this.initCash = initCash;
        this.initFee = initFee;

        this.addOpponent(type2);
        this.addOpponent(type3);
        this.addOpponent(type4);
    }

    protected void addOpponent(String type) throws PublicException
    {
        if ((type != null) && playerTypes.contains(type))
        {
            this.opponents.add(type);
        }
        else if (type != null)
        {
            throw new PublicException("Type `" + type
                    + "` of player is invalid.");
        }
    }

    public boolean isTemplate()
    {
        return (this.opponents.size() > 0);
    }

}
